package com.start.viewutils;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

import com.start.viewutils.view.piechart.ColorRandom;
import com.start.viewutils.view.piechart.PieChartView;
import com.start.viewutils.view.piechart.PieChartBean;

import java.util.ArrayList;
import java.util.List;

public class PieChartActivity extends AppCompatActivity {

    private PieChartView pieChart;
    List<PieChartBean> pieChartBeans = new ArrayList<>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_pie_chart);
        pieChart = findViewById(R.id.v_pie_chart);
        ArrayList colors = new ColorRandom(3).getColors();
        pieChartBeans.add(new PieChartBean("A", (float) 50.0, (Integer) colors.get(0)));
        pieChartBeans.add(new PieChartBean("B", (float) 25.0, (Integer) colors.get(1)));
        pieChartBeans.add(new PieChartBean("C", (float) 15.0, (Integer) colors.get(2)));
        pieChart.setDate(pieChartBeans);
    }
}